package com.ayz.gateway.center.domain.model;


import com.ayz.gateway.common.constants.DataVersion;
import lombok.Data;

/**
 * @ClassName ApplicationLiveInfo
 * @Description TODO: 存储微服务的心跳信息
 * @Author 快乐的星球
 * @Date 2023/5/13 16:16
 * @Version 1.0
 **/
@Data
public class ApplicationLiveInfo {
    /**
     * 存放上一次的心跳时间
     */
    private long lastHeartBeatTimestamp;
    /**
     * 思考一个问题:怎么判断一个微服务提供的API数据发生了变更了呢?
     * 通过数据版本比对,版本号不同说明数据发生了变更
     */
    private DataVersion dataVersion;
    /**
     * 应用程序的名称
     */
    private String applicationName;
    /**
     * 网关组的名称
     */
    private String gatewayGroup;

    public ApplicationLiveInfo(long lastHeartBeatTimestamp, DataVersion dataVersion, String applicationName) {
        this.lastHeartBeatTimestamp = lastHeartBeatTimestamp;
        this.dataVersion = dataVersion;
        this.applicationName = applicationName;
    }

    public ApplicationLiveInfo(long lastHeartBeatTimestamp, DataVersion dataVersion, String applicationName, String gatewayGroup) {
        this.lastHeartBeatTimestamp = lastHeartBeatTimestamp;
        this.dataVersion = dataVersion;
        this.applicationName = applicationName;
        this.gatewayGroup = gatewayGroup;
    }

    public ApplicationLiveInfo() {
    }
}
